package com.bocloud.service;


import com.bocloud.mappers.DepartmentMapper;
import com.bocloud.model.Department;
import com.bocloud.util.TreeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2018/12/16.
 */
@Service
public class DepartmentServiceImp implements DepartmentService {


    @Autowired
    private DepartmentMapper departmentMapper;

    /**
     * 用途：获取部门表中的所有数据
     *
     * @param
     * @return Department
     */
    @Transactional(value = "loginTransactionManager")
    @Override
    public List<Department> getAllDepartment() {
        return TreeUtil.buildByRecursive(departmentMapper.getAll());
    }
}
